//
//  SRBookRootModel.m
//  StoryShow
//
//  Created by CyonLeuMBP on 2017/4/17.
//  Copyright © 2017年 qudiandu.cn. All rights reserved.
//

#import "SRBookRootModel.h"

#import "SRBookPageModel.h"
#import "SRBookCatalogueModel.h"


@implementation SRBookRootModel


+ (NSDictionary *)JSONKeyPathsByPropertyKey {
    NSMutableDictionary *dict = [[super JSONKeyPathsByPropertyKey] mutableCopy];
    
    NSDictionary *addDict =  @{
                               @"bookID": @"book_id",
                               @"name": @"name",
                               @"gradeID": @"grade_id",
                               @"updateTime": @"update_time",
                               @"grade": @"grade",
                               
                               @"catalogues": @"catalogue",
                               @"pages": @"page"
                               };
    [dict addEntriesFromDictionary:addDict];
    
    return dict;
}


+ (NSValueTransformer *)cataloguesJSONTransformer {
    return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:[SRBookCatalogueModel class]];
}

+ (NSValueTransformer *)pagesJSONTransformer {
    return [NSValueTransformer mtl_JSONArrayTransformerWithModelClass:[SRBookPageModel class]];
}

@end
